home *** CD-ROM | disk | FTP | other *** search
Gui4CLI script | 1999-05-14 | 16.2 KB | 690 lines |
- G4C
-
- ; Gui4Cli.gc
- ; =================================================================
- ; This is the gui which is opened when you click the "Prefs" button
- ; on the Gui4Cli requester.
-
- ; If you find yourself feeling queezy after having suffered the full
- ; effect of it's poping open at you unwarned, you may change it as
- ; you see fit.. - set TABs to 3 -
-
-
- WINBIG 227 26 299 201 "Gui4Cli"
- WinType 11110001
-
- BOX 0 0 297 201 out button
-
- ; -----------------------------------------------------------------
- ; System events
- ; -----------------------------------------------------------------
-
- xOnLoad
- setgadvalues gui4cli.gc ; set default values
- path = $$G4C.editor ; update path shown
- update #this 84 $path
- sndfx = $*SNDGAD ; update sound fx shown
- update #this 89 $sndfx
- setgad gui4cli.gc 72 off
- mode = GUI
- setgad #this 903 hide ; palette lv
- palette = 0
- lvhelp = 'Choose guis to load'
- oldguidir = GUIs:
- update gui4cli.gc 50 'Port: $$g4c.port'
- gosub gui4cli.gc SetGuiStat ; starting state
- guiopen Gui4Cli.gc
-
- xonreload
- guiopen Gui4Cli.gc
- guiscreen gui4cli.gc front
-
- xOnOpen
- SetGad Gui4Cli.gc 1 OFF ; remove the appicon
- if $mode = LOAD ; refresh stuff..
- lvuse Gui4Cli.gc 10
- lvdir refresh
- elseif $mode = GUI
- lvuse Gui4Cli.gc 54
- lvdir #env:$$g4c.port
- endif
-
- xOnClose
- SetGad Gui4Cli.gc 1 ON ; open the appicon
-
- xOnFail
- ezreq "Failed.." OK ""
-
- xAppIcon 0 0 GUIs:Gui4Cli "Gui4Cli" apivar OFF
- GadID 1
- GuiOpen Gui4Cli.gc
- GuiScreen Gui4Cli.gc FRONT
- if $apivar > ' '
- andifexists DIRECTORY $apivar ; if a directory or volume icon was
- orifexists DOS $apivar ; dropped on the icon,
- lvuse Gui4Cli.gc 10 ; we cd to it..
- lvdir #$apivar
- endif
-
- ; ****** ENABLE THIS HOT KEY IF YOU WANT IT ******
- ; xHotKey "rawkey shift f1" ON ; popup key for this gui
- ; guiopen #this
- ; guiscreen #this front
- ; guiwindow #this front
-
- ; -----------------------------------------------------------------
- ; Mode CYCLER
- ; - will rotate gui through all modes
- ; -----------------------------------------------------------------
-
- XBUTTON 9 5 80 14 "Guis"
- gadid 801
- gadhelp '- List of loaded Guis'
- gosub #this SetGuiStat ; because it's also called from xOnLoad
-
- xRoutine SetguiStat
- mode = GUI
- setgad gui4cli.gc 10 HIDE ; the listview
- setgad gui4cli.gc 50/59 SHOW ; other lv & Open/close/quit etc
- setgad gui4cli.gc 60/100 HIDE
- lvuse Gui4Cli.gc 54
- lvdir #env:$$g4c.port
- setwintitle gui4cli.gc 'Port $$g4c.port : Home'
- changearg #this 801 3 16
- changearg #this 802 3 14
- changearg #this 803 3 14
- partredraw gui4cli.gc 4 17 291 181
-
- XBUTTON 90 5 80 14 "Load"
- gadhelp '- Load Guis'
- gadid 802
- mode = LOAD
- setgad gui4cli.gc 10 SHOW
- setgad gui4cli.gc 50/58 HIDE
- setgad gui4cli.gc 59 SHOW
- setgad gui4cli.gc 60/79 SHOW
- setgad gui4cli.gc 80/100 HIDE
- lvhelp = 'Choose guis from here'
- setwintitle gui4cli.gc '$oldguidir'
- changearg #this 801 3 14
- changearg #this 802 3 16
- changearg #this 803 3 14
- partredraw gui4cli.gc 4 17 291 181
-
- XBUTTON 171 5 80 16 "Prefs"
- gadhelp '- Set general preferences'
- gadid 803
- mode = SET
- setgad gui4cli.gc 10 HIDE
- setgad gui4cli.gc 50/79 HIDE
- setgad gui4cli.gc 80/89 SHOW
- ; reset tab and grid
- update #this 87 $$g4c.tab
- update #this 86 $$g4c.grid
- setwintitle gui4cli.gc 'Gui4Cli settings'
- changearg #this 801 3 14
- changearg #this 802 3 14
- changearg #this 803 3 16
- partredraw gui4cli.gc 4 17 291 181
-
-
- ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- ; -----------------------------------------------------------------
- ; GUI mode
- ; Open, Close, unload GUIs...
- ; -----------------------------------------------------------------
- ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-
- ; ------ The listview
-
- XLISTVIEW 6 66 285 132 "" guivar '' 0 DIR
- gadid 54
- gadfont #mono 8 000
- gadhelp 'These are the guis currently loaded'
- extract guivar file fname
- guiopen $fname
-
- TEXT 105 25 174 15 port 35 BOX
- gadid 50
-
- XBUTTON 15 45 20 14 "R" ; refresh list
- gadid 51
- gadhelp 'Refreshes the list of loaded guis'
- lvuse Gui4Cli.gc 54
- lvdir refresh
-
- XBUTTON 40 45 58 14 Open
- gadid 51
- gadhelp 'Will open the selected guis'
- lvuse Gui4Cli.gc 54
- lvmulti first
- while $guivar > ''
- extract guivar file fname
- guiopen $fname
- lvmulti next
- endwhile
- lvdir none
-
- XBUTTON 100 45 58 14 Close
- gadid 52
- gadhelp 'Will close the selected guis'
- lvuse Gui4Cli.gc 54
- lvmulti first
- while $guivar > ''
- extract guivar file fname
- guiclose $fname
- lvmulti next
- endwhile
- lvdir none
-
- XBUTTON 160 45 58 14 Unload
- gadid 53
- gadhelp 'Will quit the selected guis'
- lvuse Gui4Cli.gc 54
- lvmulti first
- while $guivar > ''
- extract guivar file fname
- guiquit $fname
- lvmulti next
- endwhile
- ; the guis won't actually quit until all commands have executed, so..
- reflag = 1
-
- xAfter
- if $reflag = 1
- reflag = 0
- lvdir refresh
- endif
-
- XBUTTON 235 45 20 14 "A" ; also shown in gui mode
- gadhelp 'Select all items'
- gadid 51
- lvuse Gui4Cli.gc 54
- lvdir all
-
- XBUTTON 255 45 20 14 "N"
- gadhelp 'Unselect all items'
- gadid 51
- lvuse Gui4Cli.gc 54
- lvdir none
-
- BOX 6 20 284 44 in button
- GADID 59
-
- CTEXT 18 27 'GUI Control' #screen 8 2 0 0001
- gadid 50
-
-
- ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- ; -----------------------------------------------------------------
- ; LOAD mode
- ; Load GUIs...
- ; -----------------------------------------------------------------
- ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-
- XLISTVIEW 6 66 285 132 "" guivar GUIs: 0 DIR
- gadid 10
- gadfont #mono 8 000
- gadhelp 'Listview : $lvhelp' ; we set it above according to mode
- docase $mode
- case = FAV
- setgad gui4cli.gc 71 on ; if double clicked in FAV mode
- setgad gui4cli.gc 60/63 on ; set it back to LOAD mode
- setgad gui4cli.gc 72 off ; and cd to selection
- lvhelp = 'Choose guis to load'
- lvmode DIR
- lvdir #$guivar
- mode = LOAD
- break
- case = LOAD
- if $guivar H= G4C
- guiload $guivar
- endif
- break
- endcase
-
- xlvdirhook 10
- if $mode = LOAD
- oldguidir = $$lv.dir
- setwintitle gui4cli.gc '$oldguidir'
- endif
-
- ; ----- for the box use the same as above (gadid 59)
-
- CTEXT 20 27 GuiLoad #screen 8 2 0 0001
- gadid 60
-
- XBUTTON 24 42 80 14 Load ; load
- gadhelp 'Will load the selected files if they are guis'
- gadid 60
- lvuse Gui4Cli.gc 10
- lvmulti first
- while $guivar > ''
- if $guivar H= G4C
- guiload $guivar
- endif
- lvmulti next
- endwhile
- lvdir none
-
- XBUTTON 117 42 20 14 "P"
- gadhelp 'CD to Parent dir'
- gadid 60
- lvuse Gui4Cli.gc 10
- lvdir parent
- oldguidir = $$lv.dir
- setwintitle gui4cli.gc '$oldguidir'
-
- XBUTTON 138 42 20 14 "D"
- gadhelp 'Show Volumes list'
- gadid 60
- lvuse Gui4Cli.gc 10
- lvdir disks
- oldguidir = ''
- setwintitle gui4cli.gc 'Devices'
-
- XBUTTON 171 42 20 14 "G"
- gadhelp 'Shortcut to GUIs:'
- gadid 60
- lvuse Gui4Cli.gc 10
- lvdir #Guis:
- oldguidir = GUIs:
- setwintitle gui4cli.gc 'GUIs:'
-
- XBUTTON 117 27 20 14 "A" ; also shown in gui mode
- gadhelp 'Select all items'
- gadid 60
- lvuse Gui4Cli.gc 10
- lvdir all
-
- XBUTTON 138 27 20 14 "N"
- gadhelp 'Unselect all items'
- gadid 60
- lvuse Gui4Cli.gc 10
- lvdir none
-
- ; ---------------- Favourite Loading dirs
-
- XBUTTON 192 27 58 14 "Fav"
- gadid 70
- gadhelp 'Switches to and from Favourites mode'
- lvuse gui4cli.gc 10
- if $mode = FAV
- setgad gui4cli.gc 71 on
- setgad gui4cli.gc 60/63 on
- setgad gui4cli.gc 72 off
- lvhelp = 'Choose guis to load'
- lvmode DIR
- lvdir #$oldguidir
- mode = LOAD
- else
- setgad gui4cli.gc 71 off
- setgad gui4cli.gc 60/63 off
- setgad gui4cli.gc 72 on
- lvhelp = 'Double click on a directory, or hit FAV again to cancel'
- lvmode MULTI
- lvchange guis:tools/fav/G4C.fav
- lvsort asc
- mode = FAV
- endif
-
- XBUTTON 252 27 29 14 "+"
- gadid 71
- gadhelp 'Adds the current dir the Listview is at, to your favourites'
- lvuse gui4cli.gc 10
- append guis:tools/fav/g4c.fav '\n$$lv.dir'
-
- XBUTTON 252 42 29 14 "-"
- gadid 72
- gadhelp 'Deletes selected favourite entries'
- lvuse gui4cli.gc 10
- lvmulti first
- while $guivar > ''
- lvdel -1
- lvmulti first
- endwhile
-
- XBUTTON 192 42 58 14 "Save"
- gadid 72
- gadhelp 'Save favourites to GUIs:tools/fav/G4C.fav'
- lvuse gui4cli.gc 10
- lvsave guis:tools/fav/g4c.fav
-
-
- ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- ; -----------------------------------------------------------------
- ; ===================== Gui4Cli Settings ==================
-
- ; Set general Gui4Cli preferences
- ; -----------------------------------------------------------------
- ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-
- BOX 9 81 278 39 in button
- gadid 80
-
- CTEXT 18 24 'Settings:' #screen 8 2 0 0001
- gadid 80
-
- ; ------------ Outside players
-
- XBUTTON 15 39 94 14 "Players.."
- gadid 85
- gadhelp 'Configure External players'
- ifexists variable *DEF.EDITOR
- else
- guiload guis:tools/prefs/players
- endif
- guiload guis:tools/config.gc
-
- ; ------------ Palette
-
- XPALETTE 15 54 52 16
- gadid 81
- gadhelp 'Loads the GUIs:tools/palette.gc gui'
- guiload guis:tools/palette.gc
- guiopen palette.gc
-
- XLISTVIEW 2 0 210 92 "" palfile guis:tools/palette 10 DIR
- gadid 903 ; hide it at load
-
- XBUTTON 63 54 30 15 ">" ; next palette..
- gadhelp 'Load next palette from Guis:Tools/Palette'
- gadid 81
- lvuse #this 903
- if $palette >= $$lv.tot
- palette = 0
- endif
- lvgo #$palette
- lvmulti none
- lvmulti on
- lvmulti first
- guiload $palfile Gui4Cli.gc
- ++palette
-
- ; ------------ Debug, help, tab & grid
-
- XCHECKBOX 246 54 25 15 "Debug" dbg "1" "0" OFF
- gadid 80
- gadhelp 'Sets DEBUG mode On/Off (state will not be saved)'
- if $dbg = 1
- set debug on
- else
- set debug off
- endif
-
- XCHECKBOX 162 54 25 15 Help hlp "1" "0" OFF
- gadid 80
- gadhelp 'Sets HELP On/Off (state will not be saved)'
- if $hlp = 1
- set help on
- else
- set help off
- endif
-
- XHSLIDER 162 24 90 14 Grid grid 1 20 1 "%ld"
- gadid 86
- gadhelp 'Sets the size of the Edit Grid'
- set grid $grid
-
- XHSLIDER 162 39 90 14 "Tabs" tab 0 20 8 "%ld"
- gadid 87
- gadhelp 'Sets the TAB size'
- set tab $tab
-
- ; -----------------------------------------------------------------
- ; Path & settings
- ; -----------------------------------------------------------------
-
- BOX 9 20 276 56 IN BUTTON
- gadid 83
-
- CTEXT 18 84 'Set Paths:' #screen 8 2 0 0001
- gadid 83
-
- XTEXTIN 18 99 259 15 "" path '' 140
- gadid 84
- gadhelp 'Enter the new path etc here..'
- set $setpath $path
-
- XCYCLER 117 84 161 14 "" setpath
- gadid 83
- gadhelp 'Cycles through the various things you can set.'
- CSTR 'Editor' 'editor'
- CSTR 'File Pattern' 'filepattern'
- cstr 'GuiFile Pattern' 'guipattern'
- cstr 'Gui Load dir' 'guiloaddir'
- cstr 'Default Screen' 'defscreen'
- CSTR 'Output' 'output'
- temp = '\$\$G4C.$setpath'
- update gui4cli.gc 84 '$temp'
-
- ; -----------------------------------------------------------------
- ; Sound effects
- ; -----------------------------------------------------------------
-
- BOX 9 168 280 27 IN BUTTON
- gadid 85
-
- CTEXT 21 129 "Set Sounds:" "#screen" 8 2 0 "0001"
- gadid 85
-
- XCYCLER 117 129 128 14 "" sfxevent
- gadhelp 'Cycles through the events you can set sounds for.'
- gadid 85
- cstr Gadget '*SNDGAD'
- CSTR Open '*SNDOPEN'
- CSTR Close '*SNDCLOSE'
- cstr RMB '*SNDRMB'
- cstr Keyboard '*SNDKEY'
- sampname = \$$sfxevent ; ie '$*SNDGAD'
- update #this 89 $sampname
-
- XCHECKBOX 249 129 29 14 "" usefx ON OFF ON
- gadhelp 'Checked = enable all sound effects. Unchecked = disable'
- gadid 88
- ; unload all currently loaded samples (if any)
- freesound SNDGAD
- freesound SNDOPEN
- freesound SNDCLOSE
- freesound SNDRMB
- freesound SNDKEY
- if $usefx = OFF
- stop
- endif
- ; load new ones
- if $*SNDGAD > ''
- loadsound $*SNDGAD SNDGAD
- set SNDGAD SNDGAD
- endif
- if $*SNDOPEN > ''
- loadsound $*SNDOPEN SNDOPEN
- set SNDOPEN SNDOPEN
- endif
- if $*SNDCLOSE > ''
- loadsound $*SNDCLOSE SNDCLOSE
- set SNDCLOSE SNDCLOSE
- endif
- if $*SNDRMB > ''
- loadsound $*SNDRMB SNDRMB
- set SNDRMB SNDRMB
- endif
- if $*SNDKEY > ''
- loadsound $*SNDKEY SNDKEY
- set SNDKEY SNDKEY
- endif
-
- XTEXTIN 18 144 227 15 "" sndfx '' 140
- gadhelp 'Enter the sample you want for this effect'
- gadid 89
- update #this 88 0 ; checkbox off
- $sfxevent = $sndfx
-
- XBUTTON 249 144 29 15 '<'
- gadhelp 'Opens requester so you can choose sample'
- gadid 85
- reqfile -1 -1 300 -40 'Choose Sample:' LOAD sndfx guis:tools/samp
- $sfxevent = $sndfx
- update #this 89 $sndfx
- update #this 88 0 ; checkbox off
-
-
- ; If you add stuff, give them an id of 85...
-
- ; -----------------------------------------------------------------
- ; Save prefs
- ; -----------------------------------------------------------------
-
- BOX 9 126 279 39 IN BUTTON
- gadid 85
-
- XBUTTON 144 174 127 14 "Save prefs"
- gadhelp 'Save all above settings in file Guis:Gui4Cli.prefs'
- gadid 85
-
- delete guis:gui4cli.prefs ; if it existed..
-
- .temp = 'G4C\n\n; Generated by Gui4Cli.gc on $$sys.date\n\nxONLOAD\n'
- if $palfile > ''
- append env:.temp 'GuiLoad $palfile Gui4Cli.prefs\n'
- endif
-
- ; set paths
- append env:.temp '\n; Paths\n'
- append env:.temp 'Set TAB $tab\nSet GRID $grid\n'
- append env:.temp 'Set EDITOR $$G4C.EDITOR\n'
- append env:.temp 'Set FILEPATTERN $$G4C.FILEPATTERN\n'
- append env:.temp 'Set GUIPATTERN $$G4C.GUIPATTERN\n'
- append env:.temp 'Set GUILOADDIR $$G4C.GUILOADDIR\n'
- append env:.temp 'Set DEFSCREEN $$G4C.DEFSCREEN\n'
- append env:.temp 'Set OUTPUT $$G4C.OUTPUT\n'
-
- ; set sound effects
- if $usefx = ON
- append env:.temp '\n; Sound fx\n'
-
- ; free old ones (not really needed)
- append env:.temp 'freesound SNDGAD\nfreesound SNDOPEN\nfreesound SNDCLOSE\nfreesound SNDRMB\nfreesound SNDKEY\n'
-
- if $*SNDGAD > ''
- append env:.temp 'loadsound $*SNDGAD SNDGAD\n'
- append env:.temp 'set SNDGAD SNDGAD\n'
- append env:.temp '*SNDGAD = $*SNDGAD\n'
- endif
- if $*SNDOPEN > ''
- append env:.temp 'loadsound $*SNDOPEN SNDOPEN\n'
- append env:.temp 'set SNDOPEN SNDOPEN\n'
- append env:.temp '*SNDOPEN = $*SNDOPEN\n'
- endif
- if $*SNDCLOSE > ''
- append env:.temp 'loadsound $*SNDCLOSE SNDCLOSE\n'
- append env:.temp 'set SNDCLOSE SNDCLOSE\n'
- append env:.temp '*SNDCLOSE = $*SNDCLOSE\n'
- endif
- if $*SNDRMB > ''
- append env:.temp 'loadsound $*SNDRMB SNDRMB\n'
- append env:.temp 'set SNDRMB SNDRMB\n'
- append env:.temp '*SNDRMB = $*SNDRMB\n'
- endif
- if $*SNDKEY > ''
- append env:.temp 'loadsound $*SNDKEY SNDKEY\n'
- append env:.temp 'set SNDKEY SNDKEY\n'
- append env:.temp '*SNDKEY = $*SNDKEY\n'
- endif
- endif
-
- append env:.temp '\nGuiQuit #this\n'
- copy env:.temp GUIs:Gui4Cli.prefs
- delete env:.temp
-
- ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- ; -----------------------------------------------------------------
- ; ========================== Menus
- ; -----------------------------------------------------------------
- ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-
- xMenu Project New.. '' N ; new gui
- guiclose gui4cli.gc
- guiload guis:tools/guiedit.gc
- gosub guiedit.gc newfile
- if $$ret.0 = 1 ; a gui was chosen
- guiopen guiedit.gc
- endif
-
- xmenu Project Gui.. '' '' ; use the status requester
- status
-
- xMenu Project BARLABEL '' ''
-
- xMenu Project #guis:Gui4Cli '' ''
- ezreq 'Gui4Cli\n(c)1995-99 D.Keletsekis\ndck@hol.gr' 'OK' ''
-
- xMenu Project 'Quit Gui' '' ''
- guiquit gui4cli.gc
-
- xMenu Project 'Quit Gui4Cli' '' ''
- quit
-
- ; --------------- guis menu
-
- xMenu Guis "File Manager " '' ''
- guiload guis:dir/dir.gc
- guiopen dir.gc
- guiclose gui4cli.gc
-
- xMenu Guis FSearch.gc '' ''
- guiload guis:g4c/fsearch/fsearch.gc Sys:
- guiclose gui4cli.gc
-
- xMenu Guis Rep.gc '' ''
- guiload guis:g4c/rep.gc
- guiclose gui4cli.gc
-
- xMenu Guis CedBar.gc '' ''
- guiload guis:g4c/ced/cedbar.gc
- guiclose gui4cli.gc
-
- xMenu Guis "BARLABEL" '' ''
-
- xMenu Guis Demo '' ''
- guiload guis:demo.gc
- guiopen demo.gc
- guiclose gui4cli.gc
-
- xMenu Guis Tutorials '' ''
- guiload guis:docs/tutorials.gc
- guiopen tutorials.gc
- guiclose gui4cli.gc
-
-
- ; --------------- Help menu
-
- xMenu Help "Gui4Cli Guide " '' ''
- run 'multiview guis:docs/gui4cli.guide'
-
- xMenu Help "BARLABEL" '' ''
-
- xMenu Help "Gui4Cli ReadMe" '' ''
- guiload guis:tools/read.gc guis:readme.now
-
- xMenu Help "Command List" '' ''
- guiload guis:tools/read.gc guis:docs/PrintMe
-
- xMenu Help "Version Changes" '' ''
- guiload guis:tools/read.gc guis:docs/Changes
-
- xMenu Help "BARLABEL" '' ''
-
- xMenu Help "CLI Commands Guide " '' ''
- run 'multiview guis:docs/CLICommands.guide'
-
- xMenu Help "Routines Guide" '' ''
- run 'multiview guis:docs/Routines.guide'
-
- xMenu Help "BARLABEL" '' ''
-
- xMenu Help Tutorials.. '' ''
- guiload guis:docs/tutorials.gc
- guiopen tutorials.gc
-
-
-